package model;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

import util.SimpleObject;

@XmlRootElement
public class BacSi extends ChuDe{
	private ChuyenKhoa chuyenKhoa;
	private DiaDiemYTe noiCongTac;
	private Date ngaySinh;
	private int thamNien;
	private String diaChi;
	private String soDienThoai;
	private Set<Benh> dsBenhChuyen;
	private String idNguoiDung;
	
	public BacSi(){}

	public BacSi(String tenChuDe, ChuDe chuDeCha, ChuyenKhoa chuyenKhoa, DiaDiemYTe noiCongTac, Date ngaySinh,
			int thamNien, String diaChi, String soDienThoai) {
		super(tenChuDe, chuDeCha, chuDeCha.loai);
		this.chuyenKhoa = chuyenKhoa;
		this.noiCongTac = noiCongTac;
		this.ngaySinh = ngaySinh;
		this.thamNien = thamNien;
		this.diaChi = diaChi;
		this.soDienThoai = soDienThoai;
		this.dsBenhChuyen = new HashSet<Benh>();
	}
	
	public BacSi(String tenChuDe, ChuDe chuDeCha, ChuyenKhoa chuyenKhoa, DiaDiemYTe noiCongTac, Date ngaySinh,
			int thamNien, String diaChi, String soDienThoai, String idNguoiDung) {
		super(tenChuDe, chuDeCha, chuDeCha.loai);
		this.chuyenKhoa = chuyenKhoa;
		this.noiCongTac = noiCongTac;
		this.ngaySinh = ngaySinh;
		this.thamNien = thamNien;
		this.diaChi = diaChi;
		this.soDienThoai = soDienThoai;
		this.dsBenhChuyen = new HashSet<Benh>();
		this.idNguoiDung = idNguoiDung;
	}
	
	public void addBenh(Benh benh){
		dsBenhChuyen.add(benh);
	}
	
	public ChuyenKhoa getChuyenKhoa() {
		return chuyenKhoa;
	}

	public void setChuyenKhoa(ChuyenKhoa chuyenKhoa) {
		this.chuyenKhoa = chuyenKhoa;
	}

	public DiaDiemYTe getNoiCongTac() {
		return noiCongTac;
	}

	public void setNoiCongTac(DiaDiemYTe noiCongTac) {
		this.noiCongTac = noiCongTac;
	}

	public Date getNgaySinh() {
		return ngaySinh;
	}

	public void setNgaySinh(Date ngaySinh) {
		this.ngaySinh = ngaySinh;
	}

	public int getThamNien() {
		return thamNien;
	}

	public void setThamNien(int thamNien) {
		this.thamNien = thamNien;
	}

	public String getDiaChi() {
		return diaChi;
	}

	public void setDiaChi(String diaChi) {
		this.diaChi = diaChi;
	}

	public String getSoDienThoai() {
		return soDienThoai;
	}

	public void setSoDienThoai(String soDienThoai) {
		this.soDienThoai = soDienThoai;
	}

	@XmlTransient
	public Set<Benh> getDsBenhChuyen() {
		return dsBenhChuyen;
	}

	@XmlElement(name="benhChuyen")
	public List<SimpleObject> getDsIdBenhChuyen(){
		List<SimpleObject> result = new ArrayList<SimpleObject>();
		SimpleObject obj = null;
		for (Benh benh : dsBenhChuyen) {
			obj = new SimpleObject(benh.getIdChuDe(), benh.getTenChuDe());
			result.add(obj);
		}
		return result;
	}
	
	public void setDsBenhChuyen(Set<Benh> dsBenhChuyen) {
		this.dsBenhChuyen = dsBenhChuyen;
	}

	public String getIdNguoiDung() {
		return idNguoiDung;
	}

	public void setIdNguoiDung(String idNguoiDung) {
		this.idNguoiDung = idNguoiDung;
	}
	
}
